﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using log4net;

namespace Home.WebUI.Models.Filter
{
    public class GlobalErrorForLog : HandleErrorAttribute
    {
        public override void OnException(ExceptionContext filterContext)
        {
            base.OnException(filterContext);
            ILog log = LogManager.GetLogger("WebMVCLogger");
            log.Error(filterContext.RequestContext.HttpContext.Request.RawUrl + @"\n\r" + filterContext.Exception.Message + @"\n\r" + filterContext.Exception.StackTrace);
        }
    }
}